<template>
  <div class="m_contentBox">
    <a-card :bordered="false">
      <div class="m_aCardBox">
        <div class="box1">
          <a-row :gutter="24">
            <a-col :span="6">
              <left-org ref="leftOrg" @goBack="goBack" v-if="isShow"></left-org>
            </a-col>
            <a-col :span="18">
              <sys-depart-form ref="sysDepartForm" v-if="showDeptInfo" @ok="handleOk"></sys-depart-form>
              <a-empty :description="$t('message.Please_select_the_organization')" v-else></a-empty>
            </a-col>
          </a-row>
        </div>
      </div>
    </a-card>
  </div>

</template>
<script>

import leftOrg from "./module/leftOrg.vue";
import SysDepartForm from './module/SysDepartForm.vue';

export default {
  name: 'organization',
  mixins: [],
  components: {leftOrg, SysDepartForm},
  data() {
    return {
      showDeptInfo: false,
      isShow:true
    }
  },
  created() {

  },
  methods: {
    /**
     * 编辑企业信息/新增组织/编辑组织
     * @param key 企业id/组织id
     * @param cancel 取消选择
     */
    goBack(key, cancel) {
      console.log('goBack', cancel)
      if (cancel) {
        this.showDeptInfo = false
      } else {
        this.showDeptInfo = true
        this.$nextTick(() => {
          if (key) {
            this.$refs.sysDepartForm.edit(key)
          } else {
            this.$refs.sysDepartForm.add()
          }
        })
      }
    },
    /**
     * 新增成功/编辑成功
     */
    handleOk() {
      this.showDeptInfo = false
      this.isShow = false
      this.$nextTick(() => {
        this.isShow = true
        this.$refs.leftOrg.listTree()
      })
    }
  }
}

</script>
<style lang="less" scoped>
/deep/ .ant-card-body {
  background: #F5F8F7;
}

.tabBox {
  background: #FFFFFF;
  border-radius: 3px;
}


.cardBox {
  margin-top: 24px;
  padding: 24px;
  background: #FFFFFF;
  border-radius: 3px;
}

.box1 {
  background: #fff;
  border: 1px solid #E7E7E7;
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}

.box1 {
}
</style>